#pragma once

#include <QLibrary.h>

template< typename _PluginType >
_PluginType*
loadLibrary( const char* _name, const char* _getterMethod )
{
	QLibrary library( _name );
	library.load();
	
	typedef _PluginType* (*GetterType)();

	GetterType getter = GetterType( library.resolve( _getterMethod ) );

	if( !getter )
		throw std::exception( _name );

	return getter() ;

}